<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/12/1
 * Time: 15:49
 */
namespace vendor\user\user;

use vendor\user\user;
use vendor\user\VIP1;
use vendor\user\VIP2;
use vendor\user\VIP3;

require 'user\user.php';
require 'user\VIP1.php';
require 'user\VIP2.php';
require 'user\VIP3.php';


class mageral{
    private $arr=[];
    public function Opensite(){
    $this->arr[]= $this->tolevel(0);
    $this->arr[]= $this->tolevel(0);
    $this->arr[]= $this->tolevel(1);
    $this->arr[]= $this->tolevel(2);
    $this->arr[]= $this->tolevel(3);

    echo '总共在线人数：'.count($this->arr).'<br />';
    }
    public function Closesite(){
        echo '关闭网站<br />';
    }
    public function tolevel($level){
        $user=null;
       switch ($level){

           case 0:
               $user = new user();
               break;
           case 1:
               $user = new VIP1();
               break;
           case 2:
               $user = new VIP2();
               $user->tenl();
               break;
           case 3:
               $user = new VIP3();
               $user->tenltr();
               break;
       }
        $this->olineNum();
        $user->onlevel();
        return $user;
    }

//    private  function createcommonUser(){
//        $user =new user();
//
//        $this->olineNum();
//        $user->onlevel();
//        $user->regiter();
//        $user->loign();
//        $user->updatepassword();
//        return $user;
//
//    }
//    private function createVip1User(){
//        $user1 =new VIP1();
//        $this->olineNum();
//        $user1->onlevel();
//        return $user1;
//
//    }
//    private function createVip2User(){
//        $user1 =new VIP2();
//        $this->olineNum();
//        $user1->onlevel();
//        return $user1;
//    }
//    private function createVip3User(){
//        $user1 =new VIP3();
//        $this->olineNum();
//        $user1->onlevel();
//        return $user1;
//
//    }
    private function olineNum(){
        echo '在线人数: '.user::linecount().'<br />';
    }
}

$mageral =new mageral();
$mageral->Opensite();
$mageral->Closesite();